package br.elsa.survey.domain.questions.tests;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

import br.elsa.survey.domain.questions.CheckboxQuestion;
import br.elsa.survey.domain.questions.DiscursiveQuestion;
import br.elsa.survey.domain.questions.Level;
import br.elsa.survey.domain.questions.QuestionsFactory;
import br.elsa.survey.domain.questions.RadioQuestion;

public class QuestionsFactoryTest {

	private QuestionsFactory questionsFactory;

	@Before
	public void setUp() throws Exception {

		this.questionsFactory = new QuestionsFactory();
	}

	@Test
	public void createCheckboxQuestionShouldCreateNewQuestionWithDefaultValues() {

		CheckboxQuestion question = questionsFactory.createCheckboxQuestion();

		Assert.assertEquals(1, question.getOptions().size());
		Assert.assertEquals(Level.None, question.getLevel());
		Assert.assertFalse(question.isNullableAnswer());
		Assert.assertEquals(1, question.getMinNumberChosenOptions());
		Assert.assertNull(question.getText());
		Assert.assertNull(question.getCreationDate());
	}

	@Test
	public void createRadioQuestionShouldCreateNewQuestionWithDefaultValues() {

		RadioQuestion question = questionsFactory.createRadioQuestion();

		Assert.assertEquals(1, question.getOptions().size());
		Assert.assertEquals(Level.None, question.getLevel());
		Assert.assertFalse(question.isNullableAnswer());
		Assert.assertNull(question.getText());
		Assert.assertNull(question.getCreationDate());
	}

	@Test
	public void createDiscursiveQuestionShouldCreateNewQuestionWithDefaultValues() {

		DiscursiveQuestion question = questionsFactory.createDiscursiveQuestion();

		Assert.assertEquals(Level.None, question.getLevel());
		Assert.assertFalse(question.isEmptyAnswerEnabled());
		Assert.assertNull(question.getText());
		Assert.assertNull(question.getCreationDate());
	}

}
